﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VipCo.Data;
using VipCo.Entities;

public partial class Controls_MenuTopControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HienthiThanhpho();
        }
    }

    protected void HienthiThanhpho()
    {
        int totalRows = 0;
        const string whereClause = "TrangThai = 1";
        var tlistThanhpho = DataRepository.ThanhPhoProvider.GetPaged(whereClause, "Id DESC", 0, 0, out totalRows);
        var tmpTlis = new TList<ThanhPho>();
        if (tlistThanhpho.Count > 0)
        {
            foreach (var thanhPho in tlistThanhpho)
            {
                if (thanhPho.TenThanhPho.Equals(Session["TP"]))
                {
                    linkDanang.NavigateUrl = "~/" + thanhPho.Id + "_home.aspx";
                    sessionTp.Text = thanhPho.TenThanhPho;
                }
                else
                {
                    tmpTlis.Add(thanhPho);
                }
            }
        }
        string html = "";
        foreach (var thanhPho in tmpTlis)
        {
            html += "<li><a href=" + thanhPho.Id + "_home.aspx>";
            html += thanhPho.TenThanhPho;
            html += "</a></li>";
        }

        litThanhpho.Text = html;
    }
}